'''
Created on Sep 28, 2010

@author: morgan
'''
from kml import kml, kmz, ZIP_DEFLATED
import os
#import re


class FunctionalTests(object):
    def __init__(self, test_data):
        self.data = test_data
        self.test_kmz_with_data()
        
    def test_kmz_with_data(self):
        os.chdir(self.data)
        myKmz = kmz(kml('doc.kml'), 'doc.kmz', 'w', compression=ZIP_DEFLATED)
        print myKmz.localFiles
        myKmz.write()
        myKmz.write('example.py')
        myKmz.close()
        myKmz = kmz(kml(), 'doc.kmz', 'r')
        myKmz.printdir()
        myKml = myKmz.read()
        print myKml.toStr(pretty="True")


if __name__ == '__main__':
    test_data = '../../../test_data'
    FunctionalTests(test_data)